package cn.tansanqinger.dao.sql.topic;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import cn.tansanqinger.dao.sql.IReportTopicSqlDao;
import cn.tansanqinger.pojo.Reporttopic;

@Repository
public class ReportTopicSqlDaoImpl {

	@Autowired
	private IReportTopicSqlDao dao;
	
	/**
	 * 查询数据
	 * @param o1 题目
	 * @param o2 用户
	 * @return
	 */
	public Reporttopic selectId(int o1, int o2) {
		QueryWrapper<Reporttopic> queryWrapper = new QueryWrapper<Reporttopic>();
		queryWrapper.lambda().eq(Reporttopic::getTid, o1).eq(Reporttopic::getUid, o2);
		return dao.selectOne(queryWrapper);
	}
	
	/**
	 * 添加信息
	 * @param course
	 * @return
	 */
	public int add(Reporttopic object) {
		return dao.insert(object);
	}
	
	/**
	 * 查询信息
	 * @param cid
	 * @return
	 */
	public Reporttopic selectOnt(int id) {
		return dao.selectById(id);
	}
	
	/**
	 * 修改信息
	 * @param user
	 * @return
	 */
	public int modification(Reporttopic object) {
		return dao.updateById(object);
	}
	
	/**
	 * 删除信息
	 * @param id
	 * @return
	 */
	public int delete(int id) {
		return dao.deleteById(id);
	}
}
